package com.bjpowernode.service.impl;

import com.bjpowernode.dao.DynamicDao;
import com.bjpowernode.service.DynamicService;
import com.bjpowernode.user.Dynamic;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DynamicServiceImpl implements DynamicService {

    @Resource
    private DynamicDao dynamicDao;

    @Override
    public List<Dynamic> findSomeDynamic(String someDynamic) {
        return dynamicDao.selectSomeDynamics(someDynamic);
    }

    @Override
    public List<Dynamic> findAllDynamic() {
        return dynamicDao.selectAllDynamics();
    }

    @Override
    public List<Dynamic> findUserDynamic(String username) {
        return dynamicDao.selectUserDynamic(username);
    }

    @Override
    public int addDynamic(Dynamic dynamic) {
        return dynamicDao.insertDynamic(dynamic);
    }

    @Override
    public List<Dynamic> findFollowDynamic(String name) {
        return dynamicDao.selectFollowDynamic(name);
    }

    @Override
    public List<Dynamic> findSelfDynamic(String name) {
        return dynamicDao.selectSelfDynamic(name);
    }

    @Override
    public Integer findDynamicSum(String name) {
        return dynamicDao.selectDynamicSum(name).size();
    }
}
